package interfaces.subpanel.cargardatos.gui;

import interfaces.mainpanel.gui.TesisMainGUI;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.swing.BorderFactory;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.filechooser.FileNameExtensionFilter;

import model.GenericScenarie;
import model.PercentageSplitDataSets;

import org.apache.commons.collections.CollectionUtils;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.axis.NumberAxis;
import org.jfree.chart.plot.CategoryPlot;
import org.jfree.chart.plot.PlotOrientation;
import org.jfree.data.category.DefaultCategoryDataset;
import org.jfree.ui.RectangleInsets;

import utils.ImagenesUtils;
import utils.InstancesUtils;

import com.google.common.collect.Maps;

import enumerations.AttributesEnum;

public class LoadDataSetGUI extends JPanel implements ActionListener {

	private static final String TRAINING_DATA = "Training Data";

	private static final String TESTING_DATA = "Testing Data";

	private static final String ATTRIBUTES = "Attributes";

	private static final String AMOUNT = "Amount";

	private static final long serialVersionUID = 1L;

	private TesisMainGUI mainGUI;

	private JButton openButton, clearButton, deleteButton, rightButton, leftButton, percentageButton;

	private JFileChooser fc;

	private LoadDataTableRender trainingDataTable;

	private Map<String, GenericScenarie> scenariesById = Maps.newHashMap();
	
	private LoadDataTableRender testingDataTable;

	private JRadioButton crossValidationRb, useTrainingSetRb, manualSelectionSplitRb, percentageSplitRb;

	private JTextField folds, percentage;

	private Map<AttributesEnum, List<GenericScenarie>> sublistsInstancesMap = Maps.newHashMap();

	private Map<AttributesEnum, Integer> trainInstancesMap = Maps.newHashMap(), testInstancesMap = Maps.newHashMap();

	private int total = 0;

	private JPanel chartsPanel;

	private JFreeChart trainingChart, testingChart;

	public LoadDataSetGUI(TesisMainGUI mainGUI) {

		super(new BorderLayout(2, 5));

		this.mainGUI = mainGUI;

		this.fc = new JFileChooser();
		this.fc.setFileFilter(new FileNameExtensionFilter("Excell File (*.xls)", "xls", "XLS"));

		this.openButton = new JButton("Open File...", ImagenesUtils.createImageIcon(this.getClass(), "/open.png"));
		this.openButton.addActionListener(this);

		this.clearButton = new JButton("Clear", ImagenesUtils.createImageIcon(this.getClass(), "/dropBox.png"));
		this.clearButton.addActionListener(this);
		
		this.deleteButton = new JButton("Delete Row", ImagenesUtils.createImageIcon(this.getClass(), "/delete.png"));
		this.deleteButton.addActionListener(this);
		this.deleteButton.setToolTipText("Delete selected rows from training table.");

		JPanel topPanel = new JPanel(new BorderLayout());

		JPanel testPanel = new JPanel(new GridLayout(4, 1, 10, 3));

		JPanel crossValidationPanel = new JPanel(new BorderLayout(50, 1));
		this.crossValidationRb = new JRadioButton("Cross-Validation");
		this.crossValidationRb.setToolTipText("Perform a n-cross validation form.");
		this.crossValidationRb.setSelected(true);
		this.crossValidationRb.addActionListener(this);
		JPanel foldsPanel = new JPanel(new BorderLayout(8, 1));
		this.folds = new JTextField("10", 3);
		foldsPanel.add(new JLabel("Num. Folds:"), BorderLayout.WEST);
		foldsPanel.add(this.folds, BorderLayout.CENTER);
		crossValidationPanel.add(this.crossValidationRb, BorderLayout.WEST);
		crossValidationPanel.add(foldsPanel, BorderLayout.CENTER);

		this.useTrainingSetRb = new JRadioButton("Use Training Set");
		this.useTrainingSetRb.setToolTipText("Test on the same set that the classifier is trained on.");
		this.useTrainingSetRb.setSelected(false);
		this.useTrainingSetRb.addActionListener(this);

		JPanel manualSelectionSplitPanel = new JPanel(new BorderLayout(15, 1));
		this.manualSelectionSplitRb = new JRadioButton("Manual Selection Split");
		this.manualSelectionSplitRb.setToolTipText("Train on percentage of the data and test on the remainder by manualy selection.");
		this.manualSelectionSplitRb.setSelected(false);
		this.manualSelectionSplitRb.addActionListener(this);
		JPanel passingButtonsPanel = new JPanel(new GridLayout(1, 2, 1, 1));
		this.rightButton = new JButton("", ImagenesUtils.createImageIcon(this.getClass(), "/next.png"));
		this.rightButton.setToolTipText("Select instances from training table to pass them to the testing table.");
		this.rightButton.addActionListener(this);
		this.leftButton = new JButton("", ImagenesUtils.createImageIcon(this.getClass(), "/previous.png"));
		this.leftButton.setToolTipText("Select instances from testing table to pass them to the training table.");
		this.leftButton.addActionListener(this);
		passingButtonsPanel.add(this.leftButton);
		passingButtonsPanel.add(this.rightButton);
		manualSelectionSplitPanel.add(this.manualSelectionSplitRb, BorderLayout.WEST);
		manualSelectionSplitPanel.add(passingButtonsPanel, BorderLayout.CENTER);

		JPanel percentageSplitPanel = new JPanel(new BorderLayout(48, 1));
		this.percentageSplitRb = new JRadioButton("Percentage Split");
		this.percentageSplitRb.setToolTipText("Train on percentage of the data and test on the remainder by automatic selection.");
		this.percentageSplitRb.setSelected(true);
		this.percentageSplitRb.addActionListener(this);
		JPanel percentagePanel = new JPanel(new BorderLayout(4, 1));
		this.percentage = new JTextField("0", 4);
		this.percentage.setEnabled(false);
		this.percentageButton = new JButton("Split");
		this.percentageButton.setToolTipText("Split training list into two different lists, one for training and the other for testing.");
		this.percentageButton.setEnabled(false);
		this.percentageButton.addActionListener(this);
		percentagePanel.add(this.percentage, BorderLayout.WEST);
		percentagePanel.add(new JLabel("%"), BorderLayout.CENTER);
		percentagePanel.add(this.percentageButton, BorderLayout.EAST);
		percentageSplitPanel.add(this.percentageSplitRb, BorderLayout.WEST);
		percentageSplitPanel.add(percentagePanel, BorderLayout.CENTER);

		ButtonGroup group = new ButtonGroup();
		group.add(this.crossValidationRb);
		group.add(this.useTrainingSetRb);
		group.add(this.manualSelectionSplitRb);
		group.add(this.percentageSplitRb);

		testPanel.add(crossValidationPanel);
		testPanel.add(this.useTrainingSetRb);
		testPanel.add(manualSelectionSplitPanel);
		testPanel.add(percentageSplitPanel);

		JPanel buttonPanel = new JPanel(new GridLayout(3, 1, 2, 5));
		buttonPanel.add(this.openButton);
		buttonPanel.add(this.clearButton);
		buttonPanel.add(this.deleteButton);

		topPanel.setBorder(BorderFactory.createCompoundBorder(
				BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Test Options: "), BorderFactory.createEmptyBorder(5, 5, 5, 5)),
				this.getBorder()));

		topPanel.add(testPanel, BorderLayout.WEST);
		topPanel.add(buttonPanel, BorderLayout.EAST);

		JPanel tablesPanel = new JPanel(new BorderLayout(0, 0));

		enabledMiddleButtons(false);

		this.trainingDataTable = new LoadDataTableRender(mainGUI, true, true);
		this.testingDataTable = new LoadDataTableRender(mainGUI, true, false);
		this.chartsPanel = new JPanel(new GridLayout(2, 1));

		ChartPanel trainingChartPanel = this.createEmptyPieTrainingChart(TRAINING_DATA, null, AMOUNT);
		ChartPanel testingChartPanel = this.createEmptyPieTestingChart(TESTING_DATA, ATTRIBUTES, AMOUNT);
		this.chartsPanel.add(trainingChartPanel);
		this.chartsPanel.add(testingChartPanel);

		tablesPanel.add(this.trainingDataTable, BorderLayout.WEST);
		tablesPanel.add(this.chartsPanel, BorderLayout.CENTER);
		tablesPanel.add(this.testingDataTable, BorderLayout.EAST);

		add(topPanel, BorderLayout.PAGE_START);
		add(tablesPanel);
	}

	@Override
	public void actionPerformed(ActionEvent e) {

		if (e.getSource() == this.openButton) {
			
			int returnVal = this.fc.showOpenDialog(LoadDataSetGUI.this);
			if (returnVal == JFileChooser.APPROVE_OPTION) {
				this.reset();
				File file = this.fc.getSelectedFile();
				this.trainingDataTable.loadTableWithFileContent(file);
				this.mainGUI.getClusteringGUI().addNewProjectsIds(this.trainingDataTable.getAllGenericScenaries());
				this.instantiateHashMapInstancesPerAttribute();
				completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), null);
				completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			}

		} else if (e.getSource() == this.deleteButton) {

			if (this.trainingDataTable.getSelectedRows().length > 0) {
				this.trainingDataTable.removeIndexes(this.trainingDataTable.getSelectedRows());
				this.instantiateHashMapInstancesPerAttribute();
				this.completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
				this.completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			} else {
				JOptionPane.showMessageDialog(this, "You must select at least one row to delete.", "No selection yet!",
						JOptionPane.ERROR_MESSAGE, ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
			}

		} else if (e.getSource() == this.clearButton) {

			this.reset();

		} else if (e.getSource() == this.rightButton) {

			if (this.trainingDataTable.getSelectedRows().length > 0) {
				List<GenericScenarie> selectedScenaries = this.trainingDataTable.removeIndexes(this.trainingDataTable.getSelectedRows());
				this.testingDataTable.addAllGenericScenaries(selectedScenaries);
				this.completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
				this.completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			} else {
				JOptionPane.showMessageDialog(this, "You must select at least one row to pass it to the testing table.", "No selection yet!",
						JOptionPane.ERROR_MESSAGE, ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
			}

		} else if (e.getSource() == this.leftButton) {

			if (this.testingDataTable.getSelectedRows().length > 0) {
				List<GenericScenarie> selectedScenaries = this.testingDataTable.removeIndexes(this.testingDataTable.getSelectedRows());
				this.trainingDataTable.addAllGenericScenaries(selectedScenaries);
				this.completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
				this.completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			} else {
				JOptionPane.showMessageDialog(this, "You must select at least one row to pass it back to the training table.", "No selection yet!",
						JOptionPane.ERROR_MESSAGE, ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
			}

		} else if (e.getSource() == this.percentageButton) {

			if (this.trainingDataTable.dataSize() == 0 && this.testingDataTable.dataSize() == 0) {
				JOptionPane.showMessageDialog(this, "You must open a file with the list of generic scenaries to be splitted.", "No open file yet!",
						JOptionPane.ERROR_MESSAGE, ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
				return;
			}
			if (validatePercentage()) {
				int percent = Integer.parseInt(this.percentage.getText());
				PercentageSplitDataSets splittedLists = InstancesUtils.splitDataSetByPercentage(this.sublistsInstancesMap, this.total, percent);
				this.trainingDataTable.removeAllGenericScenaries();
				this.trainingDataTable.addAllGenericScenaries(splittedLists.getTrainSet());
				this.testingDataTable.removeAllGenericScenaries();
				this.testingDataTable.addAllGenericScenaries(splittedLists.getTestSet());
				this.completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
				this.completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			}

		} else if (e.getSource() == this.crossValidationRb) {

			this.folds.setEnabled(true);
			enabledMiddleButtons(false);
			resetPercentageInputText();
			passEveryRowFromTestingToTrainingTable();
			this.percentageButton.setEnabled(false);
			completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), null);
			completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());

		} else if (e.getSource() == this.useTrainingSetRb) {

			resetFoldsInputText();
			resetPercentageInputText();
			enabledMiddleButtons(false);
			passEveryRowFromTestingToTrainingTable();
			this.percentageButton.setEnabled(false);
			completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), null);
			completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());

		} else if (e.getSource() == this.manualSelectionSplitRb) {

			resetFoldsInputText();
			resetPercentageInputText();
			enabledMiddleButtons(true);
			this.percentageButton.setEnabled(false);
			passEveryRowFromTestingToTrainingTable();
			completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());

		} else if (e.getSource() == this.percentageSplitRb) {

			resetFoldsInputText();
			enabledMiddleButtons(false);
			passEveryRowFromTestingToTrainingTable();
			enabledMiddleButtons(false);
			this.percentage.setEnabled(true);
			this.percentageButton.setEnabled(true);
			completeDataSetFromBothCharts(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
			completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
		}
	}

	private void instantiateHashMapInstancesPerAttribute() {
		this.sublistsInstancesMap.clear();
		this.total = this.trainingDataTable.getAllGenericScenaries().size() + this.testingDataTable.getAllGenericScenaries().size();
		for (GenericScenarie scenarie : this.trainingDataTable.getAllGenericScenaries()) {
			if (!this.sublistsInstancesMap.containsKey(scenarie.getAttribute())) {
				this.sublistsInstancesMap.put(scenarie.getAttribute(), new ArrayList<GenericScenarie>());
			}
			this.sublistsInstancesMap.get(scenarie.getAttribute()).add(scenarie);
		}
		for (GenericScenarie scenarie : this.testingDataTable.getAllGenericScenaries()) {
			if (!this.sublistsInstancesMap.containsKey(scenarie.getAttribute())) {
				this.sublistsInstancesMap.put(scenarie.getAttribute(), new ArrayList<GenericScenarie>());
			}
			this.sublistsInstancesMap.get(scenarie.getAttribute()).add(scenarie);
		}
	}

	private void reset() {
		this.trainingDataTable.removeAllGenericScenaries();
		this.testingDataTable.removeAllGenericScenaries();
		this.scenariesById.clear();
		this.sublistsInstancesMap.clear();
		this.total=0;
		completeDataSetFromBothCharts(null, null);
		completeInfoRowsFromTables(this.trainingDataTable.getAllGenericScenaries(), this.testingDataTable.getAllGenericScenaries());
		this.percentage.setText("0");
		this.folds.setText("10");
	}

	private void completeInfoRowsFromTables(List<GenericScenarie> traintingDataSet, List<GenericScenarie> testingDataSet) {
		if (CollectionUtils.isEmpty(traintingDataSet))
			this.trainingDataTable.setRowsQuantity(0);
		else
			this.trainingDataTable.setRowsQuantity(traintingDataSet.size());

		if (CollectionUtils.isEmpty(testingDataSet))
			this.testingDataTable.setRowsQuantity(0);
		else
			this.testingDataTable.setRowsQuantity(testingDataSet.size());
	}

	private ChartPanel createEmptyPieTrainingChart(String title, String xDescription, String ydescription) {
		DefaultCategoryDataset dataset = createEmptyDataset();
		this.trainingChart = ChartFactory.createBarChart(title, xDescription, ydescription, dataset, PlotOrientation.VERTICAL, false, true, false);
		this.trainingChart.setBorderVisible(false);
		this.trainingChart.setBackgroundPaint(null);
		this.trainingChart.getTitle().setPaint(Color.GRAY);
		this.trainingChart.setPadding(new RectangleInsets(0, 0, 0, 0));
		CategoryPlot mainPlot = this.trainingChart.getCategoryPlot();
		mainPlot.setRangeGridlinePaint(Color.red);
		mainPlot.setBackgroundPaint(Color.WHITE);
		NumberAxis mainAxis = (NumberAxis) mainPlot.getRangeAxis();
		mainAxis.setLowerBound(0);
		mainAxis.setUpperBound(280);
		ChartPanel chartPanel = new ChartPanel(this.trainingChart);
		chartPanel.setMinimumDrawWidth(550);

		return chartPanel;
	}

	private ChartPanel createEmptyPieTestingChart(String title, String xDescription, String ydescription) {
		DefaultCategoryDataset dataset = createEmptyDataset();
		this.testingChart = ChartFactory.createBarChart(title, xDescription, ydescription, dataset, PlotOrientation.VERTICAL, false, true, false);
		this.testingChart.setBorderVisible(false);
		this.testingChart.setBackgroundPaint(null);
		this.testingChart.getTitle().setPaint(Color.GRAY);
		this.testingChart.setPadding(new RectangleInsets(0, 0, 0, 0));
		CategoryPlot mainPlot = this.testingChart.getCategoryPlot();
		mainPlot.setRangeGridlinePaint(Color.red);
		mainPlot.setBackgroundPaint(Color.WHITE);
		NumberAxis mainAxis = (NumberAxis) mainPlot.getRangeAxis();
		mainAxis.setLowerBound(0);
		mainAxis.setUpperBound(280);
		ChartPanel chartPanel = new ChartPanel(this.testingChart);
		chartPanel.setMinimumDrawWidth(550);

		return chartPanel;
	}

	private DefaultCategoryDataset createEmptyDataset() {
		DefaultCategoryDataset dataSet = new DefaultCategoryDataset();
		for (AttributesEnum attribute : AttributesEnum.values())
			dataSet.setValue(0, AMOUNT, attribute.getKey());
		return dataSet;
	}

	public void completeDataSetFromBothCharts(List<GenericScenarie> trainSet, List<GenericScenarie> testSet) {

		this.trainInstancesMap = Maps.newHashMap();
		this.testInstancesMap = Maps.newHashMap();

		if (CollectionUtils.isNotEmpty(trainSet))
			for (GenericScenarie scenarie : trainSet) {
				if (!this.trainInstancesMap.containsKey(scenarie.getAttribute())) {
					this.trainInstancesMap.put(scenarie.getAttribute(), Integer.valueOf(0));
				}
				this.trainInstancesMap.put(scenarie.getAttribute(), this.trainInstancesMap.get(scenarie.getAttribute()) + 1);
			}
		if (CollectionUtils.isNotEmpty(testSet))
			for (GenericScenarie scenarie : testSet) {
				if (!this.testInstancesMap.containsKey(scenarie.getAttribute())) {
					this.testInstancesMap.put(scenarie.getAttribute(), Integer.valueOf(0));
				}
				this.testInstancesMap.put(scenarie.getAttribute(), this.testInstancesMap.get(scenarie.getAttribute()) + 1);
			}
		DefaultCategoryDataset dataSetTraining = new DefaultCategoryDataset();
		DefaultCategoryDataset dataSetTesting = new DefaultCategoryDataset();
		for (AttributesEnum attribute : AttributesEnum.values()) {
			dataSetTraining.setValue(this.trainInstancesMap.get(attribute) != null ? this.trainInstancesMap.get(attribute) : 0, AMOUNT, attribute.getKey());
			if (testSet != null)
				dataSetTesting.setValue(this.testInstancesMap.get(attribute) != null ? this.testInstancesMap.get(attribute) : 0, AMOUNT, attribute.getKey());
			else
				dataSetTesting.setValue(this.trainInstancesMap.get(attribute) != null ? this.trainInstancesMap.get(attribute) : 0, AMOUNT, attribute.getKey());

		}
		this.trainingChart.getCategoryPlot().setDataset(dataSetTraining);
		this.testingChart.getCategoryPlot().setDataset(dataSetTesting);
		this.chartsPanel.revalidate();
		this.chartsPanel.repaint();
	}

	private void passEveryRowFromTestingToTrainingTable() {

		this.trainingDataTable.addAllGenericScenaries(this.testingDataTable.getAllGenericScenaries());
		this.testingDataTable.removeAllGenericScenaries();
	}

	private void enabledMiddleButtons(boolean enable) {
		this.rightButton.setEnabled(enable);
		this.leftButton.setEnabled(enable);
	}

	private void resetFoldsInputText() {
		this.folds.setEnabled(false);
		this.folds.setText("10");
	}

	private void resetPercentageInputText() {
		this.percentage.setEnabled(false);
		this.percentage.setText("0");
	}

	public boolean validateFolds() {
		try {
			int folds = Integer.parseInt(this.folds.getText());
			if (folds <= 0 || folds > 20) {
				JOptionPane.showMessageDialog(null, "Please enter number bigger than 0 lower than 20!", "Folds Number Error!", JOptionPane.ERROR_MESSAGE,
						ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
				return false;
			}
			return true;
		} catch (NumberFormatException ex) {
			JOptionPane.showMessageDialog(null, "Check folds number. That's not a valid number!", "Number Error!", JOptionPane.ERROR_MESSAGE,
					ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
			return false;
		}
	}

	public boolean validatePercentage() {
		try {
			int percent = Integer.parseInt(this.percentage.getText());
			if (percent < 5 || percent > 90) {
				JOptionPane.showMessageDialog(null, "Please enter number between 5 and 90!", "Percentage Number Error!", JOptionPane.ERROR_MESSAGE,
						ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
				return false;
			}
			return true;
		} catch (NumberFormatException ex) {
			JOptionPane.showMessageDialog(null, "Check percentage number. That's not a valid number!", "Number Error!", JOptionPane.ERROR_MESSAGE,
					ImagenesUtils.createImageIcon(this.getClass(), "/stop.png"));
			return false;
		}
	}

	public LoadDataTableRender getTrainingDataTable() {
		return this.trainingDataTable;
	}

	public LoadDataTableRender getTestingDataTable() {
		return testingDataTable;
	}

	public TesisMainGUI getMainGUI() {
		return this.mainGUI;
	}

	public boolean isCrossValidation() {
		return this.crossValidationRb.isSelected();
	}

	public boolean isUseTrainingSetRb() {
		return this.useTrainingSetRb.isSelected();
	}

	public boolean isManualSelectionSplitRb() {
		return this.manualSelectionSplitRb.isSelected();
	}

	public boolean isPercentageSelectionSplitRb() {
		return this.percentageSplitRb.isSelected();
	}

	public String getFoldsForCrossValidation() {
		return this.folds.getText();
	}

	public Map<AttributesEnum, List<GenericScenarie>> getSublistsInstancesMap() {
		return sublistsInstancesMap;
	}

	public int getTotalNumberOfInstances() {
		return this.total;
	}

	public Map<String, GenericScenarie> getScenariesById() {
		return scenariesById;
	}

	public void setScenariesById(Map<String, GenericScenarie> scenariesById) {
		this.scenariesById = scenariesById;
	}
	
}
